//
//  XRRegistViewController.m
//  XDLookPic
//
//  Created by xiaorui on 14-4-21.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "XRRegistViewController.h"


@interface XRRegistViewController ()

@end

@implementation XRRegistViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    DDLOG_CURRENT_METHOD;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.titleLabel.text =@"注册";
    mScrollView =[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT -UI_NAVIGATION_BAR_HEIGHT -UI_STATUS_BAR_HEIGHT)];
    mScrollView.delegate =self;
    mScrollView.contentSize = CGSizeMake(UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT +80);
    mScrollView.bounces = YES;
    [self.contentView addSubview:mScrollView];
    
    UILabel *nickName=creatXRLable(@"昵   称:", CGRectMake (20,10,80,30));
    nickName.textAlignment =NSTextAlignmentLeft;
    [mScrollView addSubview:nickName];
    nickTextFiel =creatXRTextField(@"输入用户名", CGRectMake(VIEW_POINT_MAX_X(nickName),VIEW_POINT_MIN_Y(nickName),200,30));
    nickTextFiel.delegate =self;
    [mScrollView addSubview:nickTextFiel];
    
    UILabel *passWordlabel=creatXRLable(@"密   码:", CGRectMake (20,VIEW_POINT_MAX_Y(nickName),80,30));
    passWordlabel.textAlignment =NSTextAlignmentLeft;
    [mScrollView addSubview:passWordlabel];
    passwordTextFiel =creatXRTextField(@"输入密码", CGRectMake(VIEW_POINT_MAX_X(passWordlabel),VIEW_POINT_MIN_Y(passWordlabel),200,30));
    passwordTextFiel.delegate =self;
    [mScrollView addSubview:passwordTextFiel];
    
    UILabel *secPassWordLabel=creatXRLable(@"重复密码:", CGRectMake (20,VIEW_POINT_MAX_Y(passWordlabel),80,30));
    secPassWordLabel.textAlignment =NSTextAlignmentLeft;
    [mScrollView addSubview:secPassWordLabel];
    secPassWordTextFiel =creatXRTextField(@"重复密码", CGRectMake(VIEW_POINT_MAX_X(secPassWordLabel),VIEW_POINT_MIN_Y(secPassWordLabel),200,30));
    secPassWordTextFiel.delegate =self;
    [mScrollView addSubview:secPassWordTextFiel];
    
    UILabel *emailLabel=creatXRLable(@"邮   箱:", CGRectMake (20,VIEW_POINT_MAX_Y(secPassWordLabel),80,30));
    emailLabel.textAlignment =NSTextAlignmentLeft;
    [mScrollView addSubview:emailLabel];
    emailTextFiel =creatXRTextField(@"输入用户名", CGRectMake(VIEW_POINT_MAX_X(emailLabel),VIEW_POINT_MIN_Y(emailLabel),200,30));
    emailTextFiel.delegate =self;
    [mScrollView addSubview:emailTextFiel];
    
    UIButton *bnt=creatXRButton(CGRectMake(20, VIEW_POINT_MAX_Y(emailTextFiel) +20, UI_SCREEN_WIDTH -40, 40),@"注册",nil,nil);
    [bnt addTarget:self action:@selector(registButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [mScrollView addSubview:bnt];

}
-(void)registButtonClick:(UIButton *)sender{
    [self theKeyboardTextHide];

}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self theKeyboardTextHide];
}
-(void)theKeyboardTextHide{
    [nickTextFiel resignFirstResponder];
    [passwordTextFiel resignFirstResponder];
    [secPassWordTextFiel resignFirstResponder];
    [emailTextFiel resignFirstResponder];

}
- (void)backPrePage
{
    DDLOG_CURRENT_METHOD;
    [self.navigationController popViewControllerAnimated:YES];
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
